How to find smallest and largest fraction

join shbcf.ru